.TH lfs-changelog 1 "2022-11-22" Lustre "user utilities"
.SH NAME
lfs-changelog, lfs-changelog_clear \- client utility to read and clear Lustre changelogs
.SH SYNOPSIS
.br
.B lfs changelog \fR[\fB--follow\fR] \fIMDTNAME\fR [\fISTARTREC \fR[\fIENDREC\fR]]
.br
.B lfs changelog_clear \fIMDTNAME\fR \fIID\fR \fIENDREC\fR
.br
.SH DESCRIPTION
.TP
.B lfs changelog
Show the metadata changes on an MDT.  Start point
.I STARTREC
and end point
.I ENDREC
points are optional.
The
.B --follow
option will block waiting for new changes.
.TP
.B lfs changelog_clear
Indicate that changelog records previous to
.I ENDREC
are no longer of
interest to a particular consumer
.I ID
, potentially allowing the MDT to
free up disk space. An
.I ENDREC
of 0 indicates the current last record.
.PP
Changelog consumers must be registered on the
MDT node using:
.br
.BI "lctl --device " MDT_NAME " changelog_register"
.SH RETURN VALUES
.PP
Return 0 on success or a errno value on failure.
.SH ERRORS
.TP 15
.SM EINVAL
One or more invalid arguments are given.
.TP
.SM ENOENT
MDT's changelog char device or changelog user not found.
.TP
.SM EACCES
Not enough permissions to open the changelog char device. By default, the device
is only accessible to the root user.
.TP
.SM EIO
Failed to read the changelog record on the MDT.
.SH EXAMPLE
.TP
Register 2 changelog consumers on the MDT0000
.br
[root@mds]: lctl --device lustrefs-MDT0000 changelog_register
.br
lustrefs-MDT0000: Registered changelog userid 'cl1'
.br
[root@mds]: lctl --device lustrefs-MDT0000 changelog_register
.br
lustrefs-MDT0000: Registered changelog userid 'cl2'
.TP
Set changelog mask to generate changelogs for file creations
.br
[root@mds]: lctl set_param mdd.lustrefs-MDT0000.changelog_mask=CREAT
.br
mdd.lustrefs-MDT0000.changelog_mask=CREAT
.TP
Generate changelogs by creating some files on the fs
.br
[root@client]: touch /mnt/lustrefs/test{1..101}
.TP
Read changelog from number 0 to 99 on MDT0000
.br
[root@client]: lfs changelog lustrefs-MDT0000 0 99
.nf
0 01CREAT 11:03:54.129724442 2022.11.22 ...  p=[0x200000007:0x1:0x0] test1
 ....
99 01CREAT 11:03:54.129724465 2022.11.22 ...  p=[0x200000007:0x1:0x0] test100
.fi
.TP
Indicate to MDT0000 that the changelogs lower than 100 are not needed for cl1
.br
[root@client]: lfs changelog_clear  lustrefs-MDT0000 cl1 99
.br
.TP
Indicate to MDT0000 that the changelogs lower than 100 are not needed for cl2
.br
[root@client]: lfs changelog_clear  lustrefs-MDT0000 cl2 99
.br
.TP
The changelogs from 0 to 99 are cleared by the MDT:
[root@client]: lfs changelog lustrefs-MDT0000 0
.br
100 01CREAT 11:03:54.129724492 2022.11.22  ...  p=[0x200000007:0x1:0x0] test101
.SH SEE ALSO
.BR lfs (1),
.BR llapi_changelog_clear (3)
.BR llapi_changelog_recv (3)
.BR llapi_changelog_start (3)
.BR lctl-changelog_register (8)
.BR lctl-changelog_deregister (8)
